<?php

namespace App\Models\Statistical;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    /**
     * Define table name
     *
     * @var string
     */
    protected $table = 'st_users';

    /**
     * Define a primary key
     *
     * @var string
     */
    protected $primaryKey = 'user_id';

    /**
     * Define the table field information
     *
     * @var array
     */
    public $columns = [
		'user_id',
		'username',
		'password',
		'type',
        'status',
        'attribution_user_id',
		'created_at',
		'updated_at',
	];

    /**
     * A property that cannot be batched.
     *
     * @var array
     */
    protected $guarded = ['user_id'];

    /**
     * 设置密码
     *
     * @param string $value 密码值
     */
    public function setPasswordAttribute($value)
    {
        $this->attributes['password'] = bcrypt($value);
    }
}